import {
  getInfoByPage,
  addInfo,
  updateInfo,
  delInfo,
  releaseProject,
  getCustomerByPage,
  getContractAndInfoCodeNext,
  pauseOrStartProject,
  getProjectTeamInfos,
  getTeamInfos,
  changeProjectTeam,
  getPayInfoByInfoId,
  updatePayInfo,
} from '@/services/project/info';
import FileInfo from '@/pages/project/fileInfo';
import MasterPlan from '@/pages/project/masterPlan';
import BatchPlan from '@/pages/project/batchPlan';
import ProduceInfo from '@/pages/project/produceInfo';
import dayjs from '@/components/dayjs';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { Button, Form, Input, message, Modal, Table, Col, Row, Select, DatePicker } from 'antd';
import { sortTran, filterTran } from '@/utils/requestUtil';
import React, { useEffect, useRef, useState } from 'react';
import { history } from 'umi';
import { Ellipsis } from '@/components/Ellipsis';
import type { ColumnsType } from 'antd/es/table';
import type { tabType, DataType, FeeType } from '@/pages/project/type';
import { Tabs } from 'antd';
import '@/pages/project/style.less';
import { tableSearchPublicConfig } from '@/utils/filterUtils';
const Info: React.FC<{}> = (props) => {
  const actionRef = useRef<ActionType>(null);
  const [modalVisit, setModalVisit] = useState(false); // 新建和编辑提示框
  const [confirmLoading, setConfirmLoading] = useState(false); //编辑框的disable
  const [formTitle, setFormTitle] = useState('新建'); //
  const [createOrUpdate, setCreateOrUpdate] = useState(false); //编辑框的disable
  const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
  const [form] = Form.useForm();
  const [feeForm] = Form.useForm();
  const [customeCode, setCustomerCode] = useState<customerCodeType[]>();
  const [nowCustomer, setNowCustomer] = useState<nowCustom>();
  const dateFormat = 'YYYY-MM-DD';
  const [teamInfo, setTeamInfo] = useState();
  const [teamId, setTeamId] = useState();
  const [infoId, setInfoId] = useState();
  const [teamOptions, setTeamOptions] = useState();
  const [changeTeamFlag, setChangeTeamFlag] = useState(false);
  const teamNameRef = useRef(null);
  const [allTeamMenber, setAllTeamMenber] = useState();
  const [contractAmount, setContractAmount] = useState('');
  const [ticketOptions, setTicketOptions] = useState([
    { label: '是', value: '是' },
    { label: '否', value: '否' },
  ]);
  const [feeInfo, setFeeInfo] = useState<FeeType>();

  const current_contractState = props.contractState;

  //复合框
  const [editModalVisit, setEditModalVisit] = useState(false);
  const onChange = (key: string) => {};
  useEffect(() => {
    history.listen((location) => {
      setEditModalVisit(false);
    });
  }, [history]);

  //项目编辑提交
  const editSubmit = async () => {
    form
      .validateFields()
      .then(async () => {
        const res = { ...form.getFieldsValue() };
        res.contractDate = dayjs(res.contractDate).format(dateFormat);
        if (res.deliveryDate !== null) {
          res.deliveryDate = dayjs(res.deliveryDate).format(dateFormat);
        }
        const result = await updateInfo(res);
        if (result != null) {
          message.success('编辑成功');
        }
        setConfirmLoading(false);
        setModalVisit(false);
        actionRef.current!.reload();
      })
      .catch(() => {
        setConfirmLoading(false);
      });
  };

  //团队信息
  const teamInfoColumns: ColumnsType<DataType> = [
    {
      title: '名称',
      dataIndex: 'userName',
      key: 'userName',
      width: 100,
      align: 'center',
      sorter: true,
    },
    {
      title: '角色',
      dataIndex: 'category',
      key: 'category',
      width: 100,
      align: 'center',
      sorter: true,
    },
    {
      title: '电子邮箱',
      dataIndex: 'email',
      key: 'email',
      width: 100,
      align: 'center',
      sorter: true,
    },
    {
      title: '电话',
      dataIndex: 'phone',
      key: 'phone',
      width: 100,
      align: 'center',
      sorter: true,
    },
  ];
  //更换团队
  const changeTeam = () => {
    setChangeTeamFlag(true);
  };
  //确定更换团队
  const sureChangeTeam = async () => {
    const result = await changeProjectTeam(infoId, teamInfo.teamId);
    if (result && result.code === 0) {
      message.success(result.message);
    }
    setChangeTeamFlag(false);
  };

  const handleContractAmountChange = (value: any) => {
    if (value && !isNaN(value)) {
      const formattedValue = parseFloat(value).toFixed(2);
      form.setFieldsValue({ contractAmount: formattedValue });
    } else {
      setContractAmount(value);
      form.setFieldsValue({ contractAmount: value });
    }
  };

  const items: tabType[] = [
    {
      key: '0',
      name: 'tab1',
      label: `项目信息`,
      content: (
        <div>
          <Form
            name="wrap"
            labelCol={{ flex: '110px' }}
            labelAlign="left"
            labelWrap
            form={form}
            wrapperCol={{ flex: 1 }}
            colon={false}
            validateTrigger={['onBlur', 'onChange']}
          >
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item label="id" name="id" hidden={true}>
                  <Input />
                </Form.Item>
                <Form.Item
                  label="合同名称"
                  name="contractName"
                  rules={[{ required: true, message: '请输入合同名称！' }]}
                >
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item
                  label="合同编号"
                  name="contractCode"
                  rules={[{ required: true, message: '请输入合同编号！' }]}
                >
                  <Input disabled={true} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item
                  label="合同日期"
                  name="contractDate"
                  rules={[{ required: true, message: '请输入合同日期！' }]}
                >
                  <DatePicker disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item
                  label="合同金额"
                  name="contractAmount"
                  rules={[
                    { required: true, message: '请输入合同金额！' },
                    {
                      pattern:
                        /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?[\u4e00-\u9fa5]?$)|(^(0){1}[\u4e00-\u9fa5]?$)|(^[0-9]\.[0-9]([0-9])?[\u4e00-\u9fa5]?$)/,
                      message: '格式错误，只保留两位小数!',
                      validateTrigger: ['onBlur', 'onChange'],
                    },
                  ]}
                >
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item
                  label="项目名称"
                  name="projectName"
                  rules={[{ required: true, message: '请输入项目名称！' }]}
                >
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="项目编号" name="projectCode">
                  <Input disabled={true} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item label="客户名称" name="customerName">
                  <Select
                    placeholder="请选择客户名称"
                    disabled={createOrUpdate}
                    onChange={(label, value) => {
                      setNowCustomer({ customerName: value.label, customerCode: label });
                      form.setFieldsValue({
                        customerCode: label,
                      });
                    }}
                    options={customeCode}
                  />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="客户编号" name="customerCode">
                  <Input disabled />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item label="客户地址" name="customerAddress">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="联系人" name="contactName">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item label="联系电话" name="contactNo">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="交货地点" name="deliveryAddress">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={12}>
                <Form.Item
                  label="交货日期"
                  name="deliveryDate" //js jsx+typescript ts Date string 类型校验
                  rules={[{ required: true, message: '请输入交货日期!' }]}
                >
                  <DatePicker disabled={createOrUpdate} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="销售订单号" name="so">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
            </Row>
            <Row gutter={[50, 0]}>
              <Col span={24}>
                <Form.Item label="备&nbsp;&nbsp;&nbsp;&nbsp;注" name="memo">
                  <Input disabled={createOrUpdate} />
                </Form.Item>
              </Col>
            </Row>
          </Form>
          <div className="info-btn">
            <Button
              type="primary"
              onClick={() => {
                editSubmit();
              }}
            >
              确定
            </Button>
          </div>
        </div>
      ),
    },
    {
      key: '7',
      name: 'tab7',
      label: `收款信息`,
      content: (
        <div>
          <Form
            name="wrap"
            labelCol={{ flex: '110px' }}
            labelAlign="left"
            labelWrap
            form={feeForm}
            wrapperCol={{ flex: 1 }}
            colon={false}
            validateTrigger={['onBlur', 'onChange']}
          >
            <div className="fee-title">预付款</div>
            <Row gutter={[50, 0]}>
              <Col span={8}>
                <Form.Item label="id" name="id" hidden={true}>
                  <Input />
                </Form.Item>
                <Form.Item
                  label="时间"
                  name="advancePayDate"
                  rules={[{ required: true, message: '请输入时间！' }]}
                >
                  <DatePicker />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item
                  label="金额"
                  name="advancePay"
                  rules={[{ required: true, message: '请输入金额！' }]}
                >
                  <Input />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item label="比例(%)" name="advancePayRate">
                  <Input disabled />
                </Form.Item>
              </Col>
            </Row>
            <div className="fee-title">阶段款</div>
            <Row gutter={[50, 0]}>
              <Col span={8}>
                <Form.Item label="id" name="id" hidden={true}>
                  <Input />
                </Form.Item>
                <Form.Item
                  label="时间"
                  name="stagePayDate"
                  rules={[{ required: true, message: '请输入时间！' }]}
                >
                  <DatePicker />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item
                  label="金额"
                  name="stagePay"
                  rules={[{ required: true, message: '请输入金额！' }]}
                >
                  <Input />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item label="比例(%)" name="stagePayRate">
                  <Input disabled />
                </Form.Item>
              </Col>
            </Row>
            <div className="fee-title">尾 款</div>
            <Row gutter={[50, 0]}>
              <Col span={8}>
                <Form.Item label="id" name="id" hidden={true}>
                  <Input />
                </Form.Item>
                <Form.Item
                  label="时间"
                  name="finalPayDate"
                  rules={[{ required: true, message: '请输入时间！' }]}
                >
                  <DatePicker />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item
                  label="金额"
                  name="finalPay"
                  rules={[{ required: true, message: '请输入金额！' }]}
                >
                  <Input />
                </Form.Item>
              </Col>
              <Col span={8}>
                <Form.Item label="比例(%)" name="finalPayRate">
                  <Input disabled />
                </Form.Item>
              </Col>
            </Row>
            <div className="fee-title"></div>
            <Row gutter={[50, 0]}>
              <Col span={8}>
                <Form.Item label="id" name="id" hidden={true}>
                  <Input />
                </Form.Item>
                <Form.Item
                  label="是否已开票"
                  name="isInvoice"
                  rules={[{ required: true, message: '请输入是否已开票！' }]}
                >
                  <Select
                    placeholder="请选择是否已开票"
                    onChange={(value, label) => {}}
                    options={ticketOptions}
                  />
                </Form.Item>
              </Col>
              <Col span={16}>
                <Form.Item label="备注" name="contractCode">
                  <Input />
                </Form.Item>
              </Col>
            </Row>
          </Form>
          <div className="info-btn">
            <Button
              type="primary"
              onClick={async () => {
                feeForm.validateFields().then(async () => {
                  const res = { ...feeForm.getFieldsValue() };
                  if (res.advancePayDate !== null) {
                    res.advancePayDate = dayjs(res.advancePayDate).format(dateFormat);
                  }
                  if (res.stagePayDate !== null) {
                    res.stagePayDate = dayjs(res.stagePayDate).format(dateFormat);
                  }
                  if (res.finalPayDate !== null) {
                    res.finalPayDate = dayjs(res.finalPayDate).format(dateFormat);
                  }
                  res.isInvoice = res.isInvoice == '是' ? 1 : 0;
                  res.id = feeInfo!.id;
                  res.infoId = feeInfo!.infoId;
                  const result = await updatePayInfo(res);
                  console.log(result, '更新金额');
                  if (result && result.code == 0) {
                    message.success('更新成功');
                  }
                  setConfirmLoading(false);
                  setModalVisit(false);
                  actionRef.current!.reload();
                });
              }}
            >
              确定
            </Button>
          </div>
        </div>
      ),
    },
    {
      key: '2',
      name: 'tab2',
      label: `柜体编辑`,
      content: (
        <div style={{ height: 500 }}>
          <ProduceInfo produceFlag={false} produceInfoId={infoId} />
        </div>
      ),
    },
    {
      key: '3',
      name: 'tab3',
      label: `团队编辑`,
      content: (
        <div className="teamTab3">
          <div className="teamName">
            团队名称：
            <Input
              ref={teamNameRef}
              disabled
              value={teamInfo ? teamInfo.teamCode : '-'}
              style={{ width: 300 }}
            />
            <Button type="primary" onClick={changeTeam}>
              更换团队
            </Button>
          </div>
          <div>
            团队编号：
            {!changeTeamFlag ? (
              <Input
                disabled
                value={teamInfo ? teamInfo.teamName : '-'}
                style={{ width: 300, marginTop: 20 }}
              />
            ) : (
              <Select
                style={{ width: 300, marginTop: 20 }}
                placeholder="请选择团队编号"
                defaultValue={teamInfo ? teamInfo.teamName : '-'}
                onChange={(value, label) => {
                  teamNameRef.current!.input.value = value;
                  if (allTeamMenber) {
                    allTeamMenber.forEach((item) => {
                      if (item.teamName == label.label) {
                        setTeamInfo(item);
                      }
                    });
                  }
                }}
                options={teamOptions}
              />
            )}
          </div>
          <div style={{ marginTop: 20 }}>
            团队成员：
            <Table
              columns={teamInfoColumns}
              rowKey={(record) => record.id}
              bordered
              dataSource={teamInfo ? teamInfo.teamInfos : ''}
              pagination={{ pageSize: 4 }}
            />
          </div>
          <div className="sureBtn">
            <Button type="primary" disabled={!changeTeamFlag} onClick={sureChangeTeam}>
              确定
            </Button>
          </div>
        </div>
      ),
    },
    {
      key: '4',
      name: 'tab4',
      label: `项目主计划`,
      content: (
        <div style={{ height: 500 }}>
          <MasterPlan masterPlanFlag={false} masterPlanInfoId={infoId} masterPlanTeamId={teamId} />
        </div>
      ),
    },
    {
      key: '5',
      name: 'tab5',
      label: `批次计划`,
      content: (
        <div style={{ height: 500 }}>
          <BatchPlan batchPlanFlag={false} batchPlanInfoId={infoId} />
        </div>
      ),
    },
    {
      key: '6',
      name: 'tab6',
      label: `项目附件`,
      content: (
        <div style={{ height: 500, padding: 0 }}>
          <FileInfo infoFlag={false} infosId={infoId} teamsId={teamId} />
        </div>
      ),
    },

    // {
    //   key: '7',
    //   name: 'tab7',
    //   label: `进度信息`,
    //   content: <div style={{ height: 500 }}></div>,
    // },
  ];

  type nowCustom = {
    customerName: string;
    customerCode: any;
  };

  type customerCodeType = {
    label: string;
    value: string;
    id?: string;
  };

  type customer = {
    createName: string;
    createTime: string;
    customerCode: string;
    customerDesc: string;
    customerName: string;
    id: string;
  };

  const columns: ProColumns[] = [
    {
      title: '序号',
      dataIndex: 'index',
      valueType: 'index',
      width: 80,
      align: 'center',
      sorter: true,
    },
    {
      title: '合同名称',
      dataIndex: 'contractName',
      width: 200,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '合同编号',
      dataIndex: 'contractCode',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '合同日期',
      dataIndex: 'contractDate',
      valueType: 'date',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '合同金额',
      dataIndex: 'contractAmount',
      width: 90,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '销售订单号',
      dataIndex: 'so',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '项目名称',
      dataIndex: 'projectName',
      width: 180,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '项目编号',
      dataIndex: 'projectCode',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '交货日期',
      dataIndex: 'deliveryDate',
      valueType: 'date',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '项目状态',
      dataIndex: 'contractState',
      width: 90,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '客户编号',
      dataIndex: 'customerCode',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '客户名称',
      dataIndex: 'customerName',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '客户地址',
      dataIndex: 'customerAddress',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '联系人',
      dataIndex: 'contactName',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '联系电话',
      dataIndex: 'contactNo',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '交货地点',
      dataIndex: 'deliveryAddress',
      width: 110,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '备注',
      dataIndex: 'memo',
      width: 90,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '操作',
      valueType: 'option',
      width: 80,
      key: 'option',
      fixed: 'right',
      align: 'center',
      render: (text, record) => [
        <a
          key="editKey"
          onClick={async () => {
            setTeamInfo(undefined);
            setEditModalVisit(true);
            setCreateOrUpdate(true);
            //setFormTitle('编辑');
            //第一个tab页，项目信息
            form.setFieldsValue({
              city: record.city,
              contactName: record.contactName,
              contactNo: record.contactNo,
              contractAmount: record.contractAmount,
              contractCode: record.contractCode,
              contractDate: dayjs(record.contractDate, dateFormat),
              contractName: record.contractName,
              contractState: record.contractState,
              country: record.country,
              customerAddress: record.customerAddress,
              customerCode: record.customerCode,
              customerName: record.customerName,
              deliveryAddress: record.deliveryAddress,
              deliveryDate:
                record.deliveryDate === null ? null : dayjs(record.deliveryDate, dateFormat),
              memo: record.memo,
              projectCode: record.projectCode,
              projectName: record.projectName,
              province: record.province,
              reserved: record.reserved,
              serialNo: record.serialNo,
              so: record.so,
              id: record.id,
            });
            const result = await getProjectTeamInfos(record.id); //团队信息
            setTeamId(record.teamId);
            setInfoId(record.id);
            if (result === undefined) {
            } else {
              setTeamInfo(result.data);
            }
            //获取所有团队信息
            const allTeamInfo = await getTeamInfos();
            const tempAllTeamOptions: any[] = [];
            allTeamInfo.data.forEach((element) => {
              tempAllTeamOptions.push({ value: element.teamName, label: element.teamCode });
            });
            setTeamOptions(tempAllTeamOptions);
            //所有团队成员
            setAllTeamMenber(allTeamInfo.data);
            //获取付款信息
            const { data: feeResult } = await getPayInfoByInfoId(record.id);
            setFeeInfo(feeResult);
            const amount = record.contractAmount;
            const regex = /(\d+)/;
            const match = amount.match(regex);
            const number = match[1];
            feeForm.setFieldsValue({
              advancePay: feeResult.advancePay,
              advancePayDate:
                feeResult.advancePayDate && dayjs(feeResult.advancePayDate, dateFormat),
              finalPay: feeResult.finalPay,
              finalPayDate: feeResult.finalPayDate && dayjs(feeResult.finalPayDate, dateFormat),
              isInvoice: feeResult.isInvoice ? '是' : '否',
              stagePay: feeResult.stagePay,
              stagePayDate: feeResult.stagePayDate && dayjs(feeResult.stagePayDate, dateFormat),
              memo: feeResult.string,
              stagePayRate: feeResult.stagePay / Number(number),
              finalPayRate: feeResult.finalPay / Number(number),
              advancePayRate: feeResult.advancePay / Number(number),
            });
          }}
        >
          查看
        </a>,
      ],
    },
  ];

  //选中selection中的序号
  const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
    setSelectedRowKeys(newSelectedRowKeys);
  };

  return (
    <React.Fragment>
      <PageHeaderWrapper title={false} breadcrumb={undefined}>
        <ProTable
          search={{
            span: 4,
            labelWidth: 'auto',
          }}
          headerTitle="项目信息查询"
          actionRef={actionRef} //用于触发刷新操作等，看api
          rowKey="id" //表格行 key 的取值，可以是字符串或一个函数
          request={async (params = {}, sort) => {
            const sorters = sortTran(sort);
            const filters = filterTran(params);
            const filters_temp = filterTran(params);
            const result = await getInfoByPage({ ...params, sorters: sorters, filters: filters });
            // 筛选result的值
            const temp_res = result.data.content.filter((item: any) => {
              if (current_contractState == '') {
                return item.contractState;
              } else if (current_contractState == '未结束') {
                return item.contractState != '已结束';
              } else {
                return item.contractState == current_contractState;
              }
            });
            console.log(temp_res, 'temp_res');
            const temp = await getCustomerByPage({
              ...params,
              sorters: sorters,
              filters: filters_temp,
            });
            const tempType: customerCodeType[] = [];
            temp.data.content.map((item: customer) => {
              tempType.push({
                label: item.customerName,
                value: item.customerCode,
                id: item.customerCode,
              });
            });
            setCustomerCode(tempType);
            return {
              data: current_contractState == '' ? result.data.content : temp_res,
              total: current_contractState == '' ? result.data.totalElements : temp_res.length,
              success: result.success,
            };
          }}
          columns={columns}
          scroll={{ x: 2000, y: 350 }}
          rowSelection={{ onChange: onSelectChange }}
        />
      </PageHeaderWrapper>
      <Modal
        title="项目信息"
        width={1500}
        open={editModalVisit}
        onCancel={() => {
          setEditModalVisit(false);
          actionRef.current?.reload();
        }}
        onOk={() => setEditModalVisit(false)}
        footer={null}
        destroyOnClose
      >
        <Tabs
          defaultActiveKey="0"
          items={items.map((item, i) => {
            const id = String(i + 1);
            return {
              label: item.label,
              key: id,
              children: <div>{item.content}</div>,
            };
          })}
          onChange={onChange}
        />
      </Modal>
    </React.Fragment>
  );
};
export default Info;
